<?php
class Job extends AppModel {

    public $recursive = -1;
    public $name = 'Job';
    public $actsAs = array(
        'Clickable',
        'Archivable',
        'Trackable',
        'Switchable' => array(
            'fileds' => array('expired')
        ),
        'Searchable' => array(
            'name' => 'title',
            'fields' => array(
                'title', 'workplace',
                'intruduction', 'requirement',
                'company_id' => 'Company.name',
            )
        )
    );
    public $validate = array(
        'title' => array('notempty'),
        'workplace' => array('notempty'),
        'company_id' => array('numeric')
    );

    // the Associations below have been created with all possible keys,
    // those that are not needed can be removed
    public $belongsTo = array(
        'Company' => array(
            'className' => 'Company',
            'foreignKey' => 'company_id',
            'counterCache' => true,
            'conditions' => '',
            'fields' => '',
            'order' => ''
        )
    );

    public $hasAndBelongsToMany = array(
        'Student' => array(
            'className' => 'Student',
            'joinTable' => 'students_jobs',
            'foreignKey' => 'job_id',
            'associationForeignKey' => 'student_id',
            'counterCache' => true,
            'dependent' => true,
            'unique' => true,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'finderQuery' => '',
            'deleteQuery' => '',
            'insertQuery' => ''
        )
    );

}
?>